package com.example.feign.fallback;

import com.example.entity.TShopProduct;
import com.example.feign.ProductFeignApi;
import org.springframework.stereotype.Component;
/*
*   本地容错类，当feign接口请求远端服务器失败是，就会调用该类获取兜底数据
* */
@Component
public class ProductFeignFallback implements ProductFeignApi {
    @Override
    public TShopProduct get(Long pid) {
        TShopProduct product = new TShopProduct();
        product.setPid(-1L);
        product.setPname("商品错误");
        product.setPprice(0.0);
        product.setStock(0);
        return product;
    }
}
